package com.ac.app.web.action.invest;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.ac.app.dm.PickInvest;
import com.ac.app.dm.PickOrg;
import com.ac.app.web.form.PickInvestForm;

import com.caac.core.dm.User;
import com.caac.core.web.action.BaseAction;
import com.caac.core.web.form.BaseForm;

public class SavePickInvestAction extends BaseAction {

	
	protected ActionForward doExecute(ActionMapping mapping, BaseForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
	
		User user =this.getUserFromCache(request, response);
    	PickInvestForm myForm=(PickInvestForm)form;
    	PickInvest dm=myForm.getDm();
    	if(dm.getId()==null){
    		dm.setCreator(user.getId());
    		dm.setCrtTime(new Date());
    	}
    	dm.setUpdater(user.getId());
    	dm.setUptTime(new Date());
    	dm.setPrjBegdate(myForm.getTime1());
        dm.setPrjEnddate(myForm.getTime2());
    	this.getBaseManager().saveObject(dm);
        return forward(mapping);
	}

}
